
//
//  LRXAlerView.m
//  路人侠
//
//  Created by zhangxulong on 16/4/11.
//  Copyright © 2016年 zhangxulong. All rights reserved.
//

#import "LRXAlerView.h"

@implementation LRXAlerView

+ (instancetype)AlerView:(NSString *)title withMeg:(NSString * )meg
{
    return [[LRXAlerView alloc]initAlerViewWithTitle:title withMeg:meg];
}
- (instancetype)initAlerViewWithTitle:(NSString *)title withMeg:(NSString *)meg
{
    if (self = [super init]) {
        self.backgroundColor = [UIColor whiteColor];
        self.layer.cornerRadius = 5 * hScale;
        self.layer.masksToBounds = YES;
        self.frame = CGRectMake(42 * wScale, 300 * hScale, 554 * wScale, 320 * hScale);
        
        UILabel * headLabel = [[UILabel alloc]init];
        headLabel.text = title;
        headLabel.textColor = mainColor;
        headLabel.font = [UIFont systemFontOfSize:34 * hScale];
        headLabel.frame = CGRectMake(35 * wScale, 39 * hScale, 0, 0);
        [headLabel sizeToFit];
        [self addSubview:headLabel];
        
        UIView * lineView = [[UIView alloc]init];
        lineView.frame = CGRectMake(0, CGRectGetMaxY(headLabel.frame) + 43 * hScale, 554 * wScale, 5 * hScale);
        lineView.backgroundColor = mainColor;
        [self addSubview:lineView];
        
        
        UILabel * megLabel = [[UILabel alloc]init];
        megLabel.numberOfLines = 0;
        megLabel.text = meg;
        megLabel.font = [UIFont systemFontOfSize:28 * hScale];
        megLabel.frame = CGRectMake(30 * wScale, CGRectGetMaxY(lineView.frame) + 19 * hScale, 444 * wScale, 76 * hScale);
        megLabel.textAlignment = NSTextAlignmentNatural;
        
        [self addSubview:megLabel];
        
        UIButton * cancelBtn = [UIButton buttonWithType:UIButtonTypeSystem];
        [cancelBtn setTitle:@"取消" forState:UIControlStateNormal];
        cancelBtn.frame = CGRectMake(247 * wScale, 256 * hScale, 68 * wScale, 32 * hScale);
        cancelBtn.titleLabel.font = [UIFont systemFontOfSize:34 * hScale];
        
        
        UIButton * accpBtn = [UIButton buttonWithType:UIButtonTypeSystem];
        [accpBtn setTitle:@"确定" forState:UIControlStateNormal];
        accpBtn.frame = CGRectMake(416 * wScale, 256 * hScale, 68 * wScale, 32 * hScale);
        accpBtn.titleLabel.font = [UIFont systemFontOfSize:34 * hScale];
        
        
        [self addSubview:cancelBtn];
        [self addSubview:accpBtn];
        
        
    }
    return self;
}
@end
